
	 let oPlay = document.querySelector('.video-play')
	 let oImg = document.querySelector('.video-play img')
	 let oVideo = document.querySelector('.video');
	 let video=document.querySelector('video')
	 let aPersonList = document.querySelectorAll('.person-list li');
	 let oInfo = document.querySelector('.person-info');
	 let aImg = document.querySelectorAll('.person-name img');
	 let oUser = document.querySelector('.header-user');
	 let hideBox = document.querySelector('.hide-box');
	 let oBack = document.querySelector('.back');
	 let oContainer = document.querySelector('.container')
	 let oMask = document.querySelector('.mask');
	 let oSidebar = document.querySelector('.sidebar');
	 let sidebarContent = document.querySelector('.sidebar-content');
	 let omenu=document.querySelector('.menu')
	 let videoBar=document.querySelector('.videoBar')
	 let speed = document.getElementsByClassName('speed')[0];
	 let speedList = document.getElementsByClassName('speedList')[0];
	 let playTime = document.getElementsByClassName('playTime')[0];
	 let volumeAdd = document.getElementsByClassName('volumeAdd')[0];
	 let volumeIns = document.getElementsByClassName('volumeIns')[0];
	 let imgWrap = document.getElementsByClassName('review')[0];
	 let goods=document.getElementsByClassName('goods')
	 
	 oImg.onclick = function () {
	     if( video.paused ) {
	         video.play();
	         oPlay.className += ' hide';
	 		omenu.style.display = 'block';
	 		videoBar.style.display='block'
	     } else {
	         video.pause();
	         oPlay.className = 'video-play'
	     }
	 }
	 oVideo.onmouseenter = omenu.onmouseenter =videoBar.onmouseenter =  function () {
	     omenu.style.display = 'block';
	 	videoBar.style.display='block'
	 }
	 oVideo.onmouseleave = omenu.onmouseleave= videoBar.onmouseleave = function () {
	     omenu.style.display = 'none';
	 }
	 video.onclick = function () {
	     if( video.paused ) {
	         video.play();
	         oPlay.className += ' hide';
	     } else {
	         video.pause();
	         oPlay.className = 'video-play'
	     }
	 }
	 
	 window.onscroll = function () {
	     let scrollTop = document.documentElement.scrollTop;
	     if( scrollTop > 980 && window.innerWidth > 768 ) {
	         oSidebar.className += ' fix';
	         sidebarContent.style.height = '620px';
	     } else {
	         oSidebar.className = 'sidebar';
	         sidebarContent.style.height = '920px';
	     }
	 }
	 //往期回顾点击图片对应播放视频
	 function review() {
	     
	 
	     imgWrap.onclick = function (e) {
	         if (e.target.className === 'one') {
	             video.src = 'video/video01.mp4';
	             play();
	             document.documentElement.scrollTop = 409; //跳到视频区显示
	         } else if (e.target.className === 'two') {
	             video.src = 'video/video02.mp4';
	             play();
	             document.documentElement.scrollTop = 409;
	         } else if (e.target.className === 'three') {
	             video.src = 'video/video03.mp4';
	             play();
	             document.documentElement.scrollTop = 409;
	         }
	     }
	 }
	 review();
	 
	 
	 function play() {
	     if( video.paused ) {
	         video.play();
	         oPlay.className += ' hide';
	     } else {
	         video.pause();
	         oPlay.className = 'video-play'
	     }
	 }
	 //进度条
	 function barChange() {
	     videoBar.onmouseenter = function () {
	         videoBar.style.height = '10px';
	         videoBar.style.top = '-10px';
	         videoBar.children[0].style.height = '10px';
	         videoBar.children[1].style.height = '15px';
	     }
	     videoBar.onmouseleave = function () {
	         videoBar.style.height = '3px';
	         videoBar.style.top = '-2px';
	         videoBar.children[0].style.height = '3px';
	         videoBar.children[1].style.height = '6px';
	     }
	     videoBar.onclick = function (e) {
	         var location = e.layerX; //事件源需定位 相对于父元素左边距离
	         // console.log(e.layerX)
	         var width = videoBar.clientWidth;
	         var targetTime = location / width * video.duration; //跳到指定位置
	         video.currentTime = targetTime; //播放跳转
	     }
	 
	     setInterval(function () {
	         var total = video.duration; //总计时间
	         var nowTime = video.currentTime; //当前时间
	         //时间显示
	         playTime.innerText = parseInt(nowTime / 60) + ':' + parseInt(nowTime % 60) + '/' + parseInt(total / 60) + ':' + parseInt(total % 60);
	         var width = nowTime / total * videoBar.clientWidth; //圆点变化距离
	         videoBar.children[0].style.width = width + 'px';
	         videoBar.children[1].style.left = width - 2.5 + 'px';
	     }, 1000);
	 }
	 barChange();
	 
	 //速度
	 function speedChange() {
	     speed.onclick = function () {
	         speedList.style.display = 'block';
	     }
	     speedList.onmouseleave = function () {
	         speedList.style.display = 'none';
	     }
	 
	     var liList = document.querySelectorAll('.menu .speedList li');
	     for (var i = 0; i < liList.length; i++) {
	         liList[i].onmouseenter = function () {
	             this.style.color = 'green';
	         }
	         liList[i].onmouseleave = function () {
	             this.style.color = 'white';
	         }
	         liList[i].index = i;
	         liList[i].onclick = function () {
	             if (this.index === 0) { //正常速度
	                 video.playbackRate = 1;
	                 speed.innerText = '倍速';
	             } else if (this.index === 1) { //1.25
	                 video.playbackRate = 1.25;
	                 speed.innerText = '1.25';
	             } else if (this.index === 2) { //1.5
	                 video.playbackRate = 1.5;
	                 speed.innerText = '1.5';
	             } else {
	                 video.playbackRate = 2;
	                 speed.innerText = '2.0'; //2.0
	             }
	         }
	     }
	 }
	 speedChange();
	 
	 //音量
	 function volumeChange() {
	     volumeAdd.onclick = function () {
	         if (video.volume + 0.1 > 1) {
	             video.volume === 1;
	         } else {
	             video.volume += 0.1;
	         }
	     }
	     volumeIns.onclick = function () {
	         if (video.volume - 0.1 < 0) {
	             video.volume === 0;
	         } else {
	             video.volume -= 0.1;
	         }
	     }
	 }
	 volumeChange();
	 
	 /* 页面打开 */
	 window.onresize = function () {
	     let maxWidth = window.innerWidth;
	     if( maxWidth <= 768) {
	         oUser.onclick = function () {
	             hideBox.style.display = 'block';
	             oMask.style.display = 'block';
	         }
	         
	         oBack.onclick = function () {
	             hideBox.style.display = 'none';
	             oMask.style.display = 'none';
	         }
	     }
	 }
	 /* 点赞功能 */
	 for(let i=0;i<goods.length;i++){
	 	goods[i].onclick=function(){
	 		goods[i].innerHTML++;
	 		return false
	 	}
	 }
	 
 //微信扫码分享
 var show = false;
 var weixin = document.querySelector('.video .video-box .share .wx')
 var weixinCode=document.querySelector('.video .video-box  .weixinCode ')
 
 weixin.onclick = function () {
	 if (show) {	             
		 weixinCode.style.display = 'none';
		 show = false;
	 } else {
		 weixinCode.style.display = 'block';
		 show = true;
	 }
 }
 //点其他地方隐藏二维码
 document.onclick = function (e) {
	 if (e.target.className !== 'wx' && e.target.className !== 'weixinCode' && show) {
		 weixinCode.style.display = 'none';
		 show = false;
	 }
 }

